// pages/activity/index.js
const http = require('../../utils/http.js')
const config = require('../../config.js')
var app = getApp()
var IntervalName
Page({

  /**
   * 页面的初始数据
   */
  data: {
    activityLsit: [], //活动列表
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    this.activityLsit()
  },

  /**
   * 活动列表数据
   */
  activityLsit: function() {
    var that = this
    var data = {}
    http.httpReq(config.activityLsit, "GET", data, function(res) {
      if (res.data == undefined) {
        return
      }
      var activityLsit = app.cutImg(res.data)   //处理图片
      that.setData({
        activityLsit
      })
    })
  },

  /**
   * 进入活动详情
   */
  goInfoTap: function(e) {
    var id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: '../staff/index?id=' + id, //传入活动ID
    })
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {
    
  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function (e) {
    var that = this
    that.setData({
      activityLsit: [],
    })
    that.activityLsit()
    wx.stopPullDownRefresh();
  },
})
